import {localeProps} from '../../utils';

const label = '文字';
const name = 'jd-span';

export default {
    icon: 'icon-span',
    label,
    name,
    mask: false,
    rule({t}) {
        return {
            type: 'span',
            native: false,
            props: { },
            style: {
                width: '100%',
                display: 'block',
                whiteSpace: 'pre-line',
                textAlign: 'center',
                fontSize: '18px',
                fontFamily: '微软雅黑',
            },
            children: ['内容'],
        };
    },
    props(_, {t}) {
        return [
            {
                type: 'input',
                field: 'formCreateChild',
                title: '文字内容',
                props: {
                    type: 'textarea',
                    maxlength: 100,
                    showWordLimit: true,
                    rows: 5
                }
            },
            {
                type: 'object',
                field: 'formCreateStyle',
                native: false,
                props: {
                    rule: localeProps(t, name + '.props', [
                        {
                            type: 'input',
                            field: 'width',
                            hidden: true,
                            title: '标题宽度',
                            value: '100%',
                        },
                        {
                            type: 'switch',
                            field: 'whiteSpace',
                            hidden: true,
                            title: '自动换行',
                            value: 'pre-line',
                        },
                        {
                            type: 'radio',
                            field: 'textAlign',
                            title: '对齐',
                            value: 'center',
                            options: [
                                {value: 'left', label: '居左'},
                                {value: 'center', label: '居中'},
                                {value: 'right', label: '居右'},
                            ]
                        },
                        {
                            type: 'select',
                            field: 'fontSize',
                            title: '字号',
                            options: [
                                {value: '14px', label: '14px'},
                                {value: '16px', label: '16px'},
                                {value: '18px', label: '18px'},
                                {value: '24px', label: '24px'},
                                {value: '32px', label: '32px'},
                            ]
                        },
                        {
                            type: 'select',
                            field: 'fontFamily',
                            title: '字体',
                            options: [
                                {value: '微软雅黑', label: '微软雅黑'},
                                {value: 'verdana', label: 'verdana'},
                                {value: 'Arial', label: 'Arial'},
                            ]
                        }
                    ])
                }
            }

        ];
    }
};
